function e(e, t, a) {
    return t in e ? Object.defineProperty(e, t, {
        value: a,
        enumerable: !0,
        configurable: !0,
        writable: !0
    }) : e[t] = a, e;
}

function t(e, t) {
    if (!(e instanceof t)) throw new TypeError("Cannot call a class as a function");
}

function a(e, t) {
    if (!e) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
    return !t || "object" != (void 0 === t ? "undefined" : o(t)) && "function" != typeof t ? e : t;
}

function n(e, t) {
    if ("function" != typeof t && null !== t) throw new TypeError("Super expression must either be null or a function, not " + (void 0 === t ? "undefined" : o(t)));
    e.prototype = Object.create(t && t.prototype, {
        constructor: {
            value: e,
            enumerable: !1,
            writable: !0,
            configurable: !0
        }
    }), t && (Object.setPrototypeOf ? Object.setPrototypeOf(e, t) : e.__proto__ = t);
}

var o = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(e) {
    return typeof e;
} : function(e) {
    return e && "function" == typeof Symbol && e.constructor === Symbol && e !== Symbol.prototype ? "symbol" : typeof e;
}, d = function() {
    function e(e, t) {
        for (var a = 0; a < t.length; a++) {
            var n = t[a];
            n.enumerable = n.enumerable || !1, n.configurable = !0, "value" in n && (n.writable = !0), 
            Object.defineProperty(e, n.key, n);
        }
    }
    return function(t, a, n) {
        return a && e(t.prototype, a), n && e(t, n), t;
    };
}(), i = function e(t, a, n) {
    null === t && (t = Function.prototype);
    var o = Object.getOwnPropertyDescriptor(t, a);
    if (void 0 === o) {
        var d = Object.getPrototypeOf(t);
        return null === d ? void 0 : e(d, a, n);
    }
    if ("value" in o) return o.value;
    var i = o.get;
    return void 0 !== i ? i.call(n) : void 0;
}, s = function(e) {
    return e && e.__esModule ? e : {
        default: e
    };
};

Object.defineProperty(exports, "__esModule", {
    value: !0
});

var c = s(require("../../app/application")), l = function(e) {
    if (e && e.__esModule) return e;
    var t = {};
    if (null != e) for (var a in e) Object.hasOwnProperty.call(e, a) && (t[a] = e[a]);
    return t.default = e, t;
}(require("../../app/constants")), u = s(require("../../app/use_case/task_data")), r = s(require("../../utils/date_filter")), f = s(require("../../app/use_case/task_executor")), h = s(require("../../utils/log_util")), g = s(require("../../utils/controller/tabpage_controller")), _ = s(require("../../cloud/red_packet")), p = s(require("../../cloud/task")), k = s(require("../../app/store")), y = s(require("../../cloud/storage")), v = s(require("../../utils/ad_percent")), w = s(require("../../utils/cpa_storage")), m = s(require("../../utils/ad_type")), T = s(require("../../utils/sysinfo")), R = s(require("../../cloud/bug_flag")), x = require("../../utils/storage_util"), b = new (function(o) {
    function s() {
        t(this, s);
        var e = a(this, (s.__proto__ || Object.getPrototypeOf(s)).apply(this, arguments));
        return e._dlgFriendAssistance = null, e._dlgRedbagOpen = null, e._dlgRedbagOpened = null, 
        e._dlgRedbagOpened2 = null, e._dlgManyRedPacket = null, e._dlgLuckyRedPacket = null, 
        e._dlgFeedRewardTask = null, e._dlgFeedRewardFree = null, e._dlgLuckyReward = null, 
        e._dlgFeedRewardAutoShare = null, e._dlgWelfareRecommendation = null, e._pinProgram = null, 
        e._eggAni = [ 1.2, 1, .6, .8, .4 ], e._taskAni = [ 1, .8, 1.5, .6, 1.2 ], e._harvestIng = !1, 
        e._lastFeed = 0, e._lastTaskDetail = {}, e._freeFeedAdpercent = {}, e._isShowBugTips = !1, 
        e._isShowFlagTips = !1, e._newUserRedPacket = null, e;
    }
    return n(s, g.default), d(s, [ {
        key: "attached",
        value: function(e) {
            i(s.prototype.__proto__ || Object.getPrototypeOf(s.prototype), "attached", this).call(this, e), 
            c.default.notifyCenter.register(l.NotifyEvent.TASK_DATA_CHANGE, this._onTaskDataChange.bind(this), null), 
            c.default.notifyCenter.register(l.NotifyEvent.MONEY_CHANGE, this._onEggFeedChange.bind(this), null), 
            c.default.notifyCenter.register(l.NotifyEvent.HARVEST_INFO_CHANGE, this._onHarvestDataChange.bind(this), null), 
            c.default.notifyCenter.register(l.NotifyEvent.CATCH_FREE_FEED, this.onFreeFeedTimes.bind(this), null), 
            c.default.notifyCenter.register(l.NotifyEvent.CATCH_LUCKY_EGG, this.onLuckyEggTimes.bind(this), null), 
            c.default.notifyCenter.register(l.NotifyEvent.CATCH_AWARD_TASK, this.onAwardTask.bind(this), null), 
            c.default.notifyCenter.register(l.NotifyEvent.BALLOON_INFO_CHANGE, this._balloonInfoChange.bind(this), null);
        }
    }, {
        key: "detached",
        value: function() {
            i(s.prototype.__proto__ || Object.getPrototypeOf(s.prototype), "detached", this).call(this), 
            wx.setStorageSync("last_time_data", Date.now()), c.default.notifyCenter.remove(l.NotifyEvent.TASK_DATA_CHANGE, this._onTaskDataChange.bind(this), null), 
            c.default.notifyCenter.remove(l.NotifyEvent.HARVEST_INFO_CHANGE, this._onHarvestDataChange.bind(this), null), 
            c.default.notifyCenter.remove(l.NotifyEvent.MONEY_CHANGE, this._onEggFeedChange.bind(this), null), 
            c.default.notifyCenter.remove(l.NotifyEvent.CATCH_FREE_FEED, this.onFreeFeedTimes.bind(this), null), 
            c.default.notifyCenter.remove(l.NotifyEvent.CATCH_LUCKY_EGG, this.onLuckyEggTimes.bind(this), null), 
            c.default.notifyCenter.remove(l.NotifyEvent.CATCH_AWARD_TASK, this.onAwardTask.bind(this), null), 
            c.default.notifyCenter.remove(l.NotifyEvent.BALLOON_INFO_CHANGE, this._balloonInfoChange.bind(this), null);
        }
    }, {
        key: "ready",
        value: function() {
            i(s.prototype.__proto__ || Object.getPrototypeOf(s.prototype), "ready", this).call(this), 
            this._dlgFriendAssistance = this._component.selectComponent("#dlgFriendAssistance"), 
            this._dlgRedbagOpen = this._component.selectComponent("#dlgRedbagOpen"), this._dlgRedbagOpened = this._component.selectComponent("#dlgRedbagOpened"), 
            this._dlgRedbagOpened2 = this._component.selectComponent("#dlgRedbagOpened2"), this._dlgManyRedPacket = this._component.selectComponent("#dlgManyRedpacket"), 
            this._pinProgram = this._component.selectComponent("#pin_program"), this._dlgFeedRewardTask = this._component.selectComponent("#dlg_feed_reward_task"), 
            this._dlgFeedRewardFree = this._component.selectComponent("#dlg_feed_reward_free"), 
            this._dlgLuckyReward = this._component.selectComponent("#dlg_lucky_reward"), this._dlgFeedRewardAutoShare = this._component.selectComponent("#dlg_feed_reward_auto_share"), 
            this._dlgLuckyRedPacket = this._component.selectComponent("#dlgLuckyRedpacket"), 
            this._dlgWelfareRecommendation = this._component.selectComponent("#dlgWelfareRecommendation"), 
            c.default.eggLayLogic.onAppShow(), this._handleNoviceGuidance(), this.handleLuckyEgg(), 
            this.handleFreeFeed(), this._handleBugFlag(), c.default.balloonLogic.info().then(function() {}).catch(function() {}), 
            this.judgePumpBalloon();
        }
    }, {
        key: "onShow",
        value: function() {
            var e = this, t = wx.getStorageSync("openRedpacket");
            t && Date.now() - t.clickNowTime < t.diffValue && (k.default.data.index.isOpenRedpacket = 0), 
            this._dlgFeedRewardTask && k.default.data.index.extrewardTaskDlgShow ? (k.default.data.index.extrewardTaskDlgShow = !1, 
            this._dlgFeedRewardTask.hide(), console.log("extrewardTaskDlgShow 双倍奖励"), c.default.extreLogic.verb3(k.default.data.index.extrewardTask, k.default.data.index.taskAdType).then(function(e) {
                e && e.data && e.data.ebcnt > 0 && wx.showToast({
                  title: "获取 " + e.data.ebcnt / 1e3 + " 克饲料",
                    icon: "none"
                }), c.default.moneyLogic.query().then(function() {}).catch(function() {});
            }).catch(function() {})) : this._dlgFeedRewardFree && k.default.data.index.extrewardFreeDlgShow ? (k.default.data.index.haveFreeFeed = !1, 
            k.default.data.index.extrewardFreeDlgShow = !1, this._dlgFeedRewardFree.hide(), 
            console.log("extrewardFreeDlgShow 双倍奖励"), this._component.setData({
                freeFeedAward: 0
            }), c.default.extreLogic.verb3(k.default.data.index.extrewardFree, k.default.data.index.freeAdType).then(function(e) {
                e && e.data && e.data.ebcnt > 0 && wx.showToast({
                  title: "获取 " + e.data.ebcnt / 1e3 + " 克饲料",
                    icon: "none"
                }), c.default.moneyLogic.query().then(function() {}).catch(function() {});
            }).catch(function() {})) : this._dlgLuckyReward && k.default.data.index.extrewardColseggDlgShow ? (k.default.data.index.extrewardColseggDlgShow = !1, 
            this._dlgLuckyReward.hide(), this._component.store.data.index.haveColsegg = !1, 
            this._component.setData({
                isHasLuckyEgg: !1
            }), console.log("extrewardColseggDlgShow 双倍奖励"), c.default.extreLogic.verb3(k.default.data.index.extrewardColsegg, k.default.data.index.luckyEggAdType).then(function(t) {
                t && t.data && t.data.ebcnt > 0 && (e._dlgRedbagOpened2.show(Number(t.data.ebcnt / 100)), 
                c.default.moneyLogic.query().then(function() {}).catch(function() {})), setTimeout(function() {
                    e.handleLuckyEgg();
                }, 1e3);
            }).catch(function() {
                setTimeout(function() {
                    e.handleLuckyEgg();
                }, 1e4);
            })) : c.default.moneyLogic.query().then(function() {}).catch(function() {}), u.default.fetchAllTasks(), 
            this._harvestIng = !1, k.default.data.interstitialHomeAd && k.default.data.interstitialHomeAd.show(), 
            this.judgePumpBalloon(), console.log("index show");
        }
    }, {
        key: "judgePumpBalloon",
        value: function() {
            x.judgeStorageIsToday("air_balloon_pp") ? this._component && this._component.setData({
                isShowPumpBalloonPp: !1
            }) : this._component && this._component.setData({
                isShowPumpBalloonPp: !0
            });
        }
    }, {
        key: "onLuckyEgg",
        value: function() {
            var e = this;
            k.default.data.index.extrewardColseggDlgShow = !1, this._component.store.data.index.haveColsegg = !1, 
            this._component.setData({
                isHasLuckyEgg: !1
            }), this._dlgLuckyReward && this._dlgLuckyReward.hide(), c.default.extreLogic.verb3(k.default.data.index.extrewardColsegg, 0).then(function(t) {
                t && t.data && t.data.ebcnt > 0 && (e._dlgRedbagOpened2.show(Number(t.data.ebcnt / 100)), 
                c.default.moneyLogic.query().then(function() {}).catch(function() {}), x.setStorageInToday("luckyEgg")), 
                setTimeout(function() {
                    e.handleLuckyEgg();
                }, 1e3);
            }).catch(function() {
                setTimeout(function() {
                    e.handleLuckyEgg();
                }, 61e3);
            });
        }
    }, {
        key: "onLuckyEggTimes",
        value: function() {
            var e = this;
            this._component.store.data.index.haveColsegg = !1, this._component.setData({
                isHasLuckyEgg: !1
            }), this._dlgLuckyReward && this._dlgLuckyReward.hide(), c.default.extreLogic.verb3(k.default.data.index.extrewardColsegg, k.default.data.index.luckyEggAdType).then(function(t) {
                t && t.data && t.data.ebcnt > 0 && (e._dlgRedbagOpened2.show(Number(t.data.ebcnt / 100)), 
                2 == k.default.data.index.luckyEggAdType && w.default.change(), x.setStorageInToday("luckyEgg"), 
                c.default.moneyLogic.query().then(function() {}).catch(function() {})), setTimeout(function() {
                    e.handleLuckyEgg();
                }, 1e3);
            }).catch(function() {
                setTimeout(function() {
                    e.handleLuckyEgg();
                }, 61e3);
            });
        }
    }, {
        key: "onLuckyRedpacket",
        value: function() {
            var e = this;
            this._component.store.data.index.haveLuckyRedpacket = !1, this._component.setData({
                isHasLuckyRedpacket: !1
            }), this._dlgLuckyRedPacket && this._dlgLuckyRedPacket.hide(), c.default.extreLogic.verb3(k.default.data.index.extrewardLuckyRedpacket, 0).then(function(t) {
                t && t.data && t.data.ebcnt > 0 && (e._dlgRedbagOpened2.show(Number(t.data.ebcnt / 100)), 
                c.default.moneyLogic.query().then(function() {}).catch(function() {}), x.setStorageInToday("luckyRedpacket")), 
                setTimeout(function() {
                    e.handleLuckyRedpacket();
                }, 1e3);
            }).catch(function() {
                setTimeout(function() {
                    e.handleLuckyRedpacket();
                }, 61e3);
            });
        }
    }, {
        key: "onLuckyRedpacketTimes",
        value: function() {
            var e = this;
            this._component.store.data.index.haveLuckyRedpacket = !1, this._component.setData({
                isHasLuckyRedpacket: !1
            }), this._dlgLuckyRedPacket && this._dlgLuckyRedPacket.hide(), c.default.extreLogic.verb3(k.default.data.index.extrewardLuckyRedpacket, k.default.data.index.luckyReapacketAdType).then(function(t) {
                t && t.data && t.data.ebcnt > 0 && (e._dlgRedbagOpened2.show(Number(t.data.ebcnt / 100)), 
                c.default.moneyLogic.query().then(function() {}).catch(function() {}), x.setStorageInToday("luckyRedpacket")), 
                setTimeout(function() {
                    e.handleLuckyRedpacket();
                }, 1e3);
            }).catch(function() {
                setTimeout(function() {
                    e.handleLuckyRedpacket();
                }, 61e3);
            });
        }
    }, {
        key: "onFreeFeedTimes",
        value: function() {
            k.default.data.index.haveFreeFeed = !1, k.default.data.index.extrewardFreeDlgShow = !1, 
            this._dlgFeedRewardFree.hide(), console.log("extrewardFreeDlgShow 双倍奖励"), this._component.setData({
                freeFeedAward: 0
            }), c.default.extreLogic.verb3(k.default.data.index.extrewardFree, k.default.data.index.freeAdType).then(function(e) {
                e && e.data && e.data.ebcnt > 0 && wx.showToast({
                  title: "获取 " + e.data.ebcnt / 1e3 + " 克饲料",
                    icon: "none"
                }), 2 == k.default.data.index.freeAdType && w.default.change(), c.default.moneyLogic.query().then(function() {}).catch(function() {});
            }).catch(function() {});
        }
    }, {
        key: "onFreeFeed",
        value: function(e) {
            console.log("免费水滴的传参:", e), k.default.data.index.haveFreeFeed = !1, 1 != e.detail && this._dlgFeedRewardFree && this._dlgFeedRewardFree.hide(), 
            this._component.setData({
                freeFeedAward: 0
            }), c.default.extreLogic.verb3(k.default.data.index.extrewardFree, 1 != e.detail ? k.default.data.index.freeAdType : 0).then(function(t) {
                1 != e.detail && t && t.data && t.data.ebcnt > 0 && wx.showToast({
                  title: "获取 " + t.data.ebcnt / 1e3 + " 克饲料",
                    icon: "none"
                }), c.default.moneyLogic.query().then(function() {}).catch(function() {});
            }).catch(function() {});
        }
    }, {
        key: "onAwardTask",
        value: function(e) {
            console.log("完成任务领奖励的传参:", e), 1 != e.detail && this._dlgFeedRewardTask && this._dlgFeedRewardTask.hide(), 
            c.default.extreLogic.verb3(k.default.data.index.extrewardTask, 1 != e.detail ? k.default.data.index.taskAdType : 0).then(function(t) {
                1 != e.detail && t && t.data && t.data.ebcnt > 0 && wx.showToast({
                  title: "获取 " + t.data.ebcnt / 1e3 + " 克饲料",
                    icon: "none"
                }), 1 != e.detail && 2 == k.default.data.index.taskAdType && w.default.change(), 
                c.default.moneyLogic.query().then(function() {}).catch(function() {});
            }).catch(function() {});
        }
    }, {
        key: "onMoreRedPacket",
        value: function() {
            this._dlgRedbagOpened2 && this._dlgRedbagOpened2.hide(), this._dlgManyRedPacket.show();
        }
    }, {
        key: "productEgg",
        value: function(e) {
            var t = this;
            console.log("产蛋收到的参数:", e.detail), e.detail ? (console.log("现在走了加速产蛋！"), c.default.inviteLogic.acceLayExec().then(function(e) {
                c.default.eggLayLogic.lastTime = Date.now(), t._updateEggFeedHarvest();
            }).catch(function() {})) : (console.log("现在是正常流程倒计时产蛋！"), c.default.eggLayLogic.eggLay(10).then(function() {
                c.default.eggLayLogic.lastTime = Date.now(), t._updateEggFeedHarvest();
            }).catch(function() {}));
        }
    }, {
        key: "navigationBar",
        value: function() {
            return {
                BackgroundColor: "#7ae9ff",
                TextStyle: "#ffffff",
                loadingStyle: "dark"
            };
        }
    }, {
        key: "taskClickCallback",
        value: function(e) {
            h.default.d(h.default.TAG_ALL, "点击首页任务列表：!", e);
            var t = e.detail, a = t.task_type;
            "add_to_my_mini_program" !== a ? f.default.isSuppoert(a) ? (t.res_config.task_id = t.task_id, 
            t.res_config.tap = 4, t.res_config.click = 100, t.res_config.reportId = t.task_id, 
            t.res_config.from = t.from ? t.from : "", f.default.do(a, t.res_config)) : h.default.e(h.default.TAG_ALL, "[onClickTaskItem] task not support task_type", a) : this._pinProgram.show();
        }
    }, {
        key: "_updateIndexTaskStatus",
        value: function(e) {
            (e = e.filter(function(e) {
                if (!e.res_config.platform || e.res_config.platform == c.default.sysInfo.platform() || e.res_config.platform == T.default.PLATFORM_ANDROID_IOS) return !0;
            })).sort(function(e, t) {
                return e.task_stat == t.task_stat ? e.task_order - t.task_order : e.task_stat - t.task_stat;
            }), this._component.store.data.index.taskList = e, console.log("当前的任务数据：", this._component.data.taskList, this._component.store.data.index.taskList, e, c.default.sysInfo.platform(), T.default.PLATFORM_ANDROID_IOS), 
            e.some(function(e) {
                return 1 == e.task_stat;
            }) || 1 == k.default.data.switchData.welfare_for_task && this._handleWelfareRecomendation();
        }
    }, {
        key: "_updateSelfTaskStatus",
        value: function(e) {
            this._component.setData({
                selfBirthTask: e
            });
        }
    }, {
        key: "_onTaskDataChange",
        value: function() {
            h.default.i(h.default.TAG_ALL, "获取取到的任务数据index!", u.default.getAllTasks());
            var e = u.default.getTaskByTaskType("task_home"), t = u.default.getTaskByTaskType("produce_feed_list");
            e && this._updateIndexTaskStatus(e.sub_tasks), t && this._updateSelfTaskStatus(t.sub_tasks), 
            c.default.notifyCenter.fire(l.NotifyEvent.NOTIFY_HARVEST_QUERY);
        }
    }, {
        key: "_onHarvestDataChange",
        value: function(e, t) {
            this._component.store.data.switchData.egg_harvest && this.getEggHrvestList(), this._component.store.data.switchData.task_harvest && this.getTaskHrvestList();
        }
    }, {
        key: "seekFeed",
        value: function() {
            this._component.setData({
                tipsType: 0,
                produceEggsCount: 0,
                speedUping: 0
            }), this._chickenTipsInit().then(function() {});
        }
    }, {
        key: "startTimeCount",
        value: function(e, t) {
            this._component.setData({
                produceEggsCount: e,
                speedUping: t
            }), this._chickenTipsInit().then(function() {});
        }
    }, {
        key: "_chickenTipsInit",
        value: function() {
            var e = this;
            return new Promise(function(t, a) {
                e._component.setData({
                    chickenTipsShow: !1
                }), setTimeout(function() {
                    e._component.setData({
                        chickenTipsShow: !0
                    }), t();
                }, 100);
            });
        }
    }, {
        key: "getEggHrvestList",
        value: function() {
            var e = this._hrvestEggDataHandle(c.default.harvestLogic.getHarvestList(l.default.APPLE_AWARD));
            this._component.store.data.index.eggHarvest = e, console.log("获取到的鸡蛋收割列表:", e);
        }
    }, {
        key: "getTaskHrvestList",
        value: function() {
            var e = this._hrvestTaskDataHandle(c.default.harvestLogic.getHarvestList(l.default.WATER_AWARD));
            this._component.setData({
                pageTaskHarvest: e
            }), console.log("获取到的任务收割列表:", e);
        }
    }, {
        key: "harvestEggReceive",
        value: function(e) {
            h.default.i(h.default.TAG_ALL, "收割苹果的奖励信息:", e), this._harvestReceive(e, "eggHarvest");
        }
    }, {
        key: "harvestTaskReceive",
        value: function(e) {
            h.default.i(h.default.TAG_ALL, "收割任务的奖励信息:", e), this._harvestReceive(e, "taskHarvest");
        }
    }, {
        key: "_harvestReceive",
        value: function(e, t) {
            var a = this;
            this._harvestIng = !0;
            var n = null;
            ("produce_feed" == e.task_type && 1 != k.default.data.switchData.auto_feed_dlg_type || "produce_feed" != e.task_type) && (n = v.default.getAdPercentInType("produce_feed" == e.task_type ? "auto_percent" : "task_percent"), 
            k.default.data.index.taskAdType = m.default.getType(n.type), console.log("任务相关的广告概率:", n)), 
            console.log("这里收割的任务参数:", "id:" + e.id, "source:" + e.source, "detail:" + e, "ebanstat:" + m.default.getType(n.type)), 
            c.default.harvestLogic.harvest(e.id, e.source - 0, m.default.getType(n.type)).then(function(o) {
                o && o.data.extreward && (console.log("_harvestReceive:", o), o.data.extreward.ebcnt > 0 && (k.default.data.index.extrewardTask = o.data.extreward, 
                "produce_feed" == e.task_type ? 1 == k.default.data.switchData.auto_feed_dlg_type ? (k.default.data.index.extrewardAutoBase = e.revenue, 
                0 != k.default.data.switchData.show_auto_feed && a._dlgFeedRewardAutoShare.show()) : (k.default.data.index.extrewardTaskBase = e.revenue, 
                0 != k.default.data.switchData.show_auto_feed && a._dlgFeedRewardTask.show(n)) : (k.default.data.index.extrewardTaskBase = e.revenue, 
                0 != k.default.data.switchData.show_task_feed && a._dlgFeedRewardTask.show(n)))), 
                a._harvestAniHandle(e.id, t), setTimeout(function() {
                    a._updateEggFeedHarvest();
                }, 800);
            }).catch(function() {
                a._harvestIng = !1;
            });
        }
    }, {
        key: "_updateEggFeedHarvest",
        value: function() {
            c.default.notifyCenter.fire(l.NotifyEvent.NOTIFY_HARVEST_QUERY), c.default.notifyCenter.fire(l.NotifyEvent.EGG_CHANGE);
        }
    }, {
        key: "_harvestAniHandle",
        value: function(e, t) {
            var a = -1;
            "eggHarvest" === t && (a = this._getIndexById(this._component.store.data.index.eggHarvest, e), 
            this._component.store.data.index.eggHarvest[a].harvestClass = t), "taskHarvest" === t && (a = this._getIndexById(this._component.data.pageTaskHarvest, e), 
            this._component.data.pageTaskHarvest[a].harvestClass = t, this._component.setData({
                pageTaskHarvest: this._component.data.pageTaskHarvest
            }));
        }
    }, {
        key: "_hrvestEggDataHandle",
        value: function(e) {
            for (var t = 0, a = e.length; t < a; t++) e[t].aniName = "floatAniYp5", e[t].harvestClass = "", 
            e[t].duration = this._eggAni[t] ? this._eggAni[t] : 1, e[t].revenue = r.default.decimalHandler(e[t].revenue / 5e5);
            return e;
        }
    }, {
        key: "_hrvestTaskDataHandle",
        value: function(e) {
            for (var t = !1, a = 0, n = e.length; a < n; a++) if (e[a].aniName = "fadeInBT", 
            e[a].duration = this._taskAni[a] ? this._taskAni[a] : 1, e[a].revenue = r.default.decimalHandler(e[a].revenue / 1e3), 
            22 == e[a].event_type) {
                var o = null;
                "produce_feed" == e[a].task_type ? (t = !0, o = this._getResConfigByTaskId(e[a].task_id, this._component.data.selfBirthTask)) : o = this._getResConfigByTaskId(e[a].task_id, this._component.store.data.index.taskList), 
                e[a].event = o && o.res_config && o.res_config.harvest_desc ? o.res_config.harvest_desc : "", 
                "" == e[a].event && (o = this._getResConfigByTaskId(e[a].task_id, this._component.store.data.sign.taskList), 
                e[a].event = o && o.res_config && o.res_config.harvest_desc ? o.res_config.harvest_desc : "完成任务奖励"), 
                e[a].count = o && 1 === o.task_stat && o.task_target ? o.task_target : 0;
            }
            if (!t) {
                var d = this._hrvestSelfTaskCreate();
                d && (e.unshift(d), 1 != e.length || 0 != k.default.data.index.isOpenRedpacket && 0 != k.default.data.switchData.open_packet_papaw || 0 != this._component.data.freeFeedAward && 0 != k.default.data.switchData.show_free_feed || !k.default.data.isAttendanced || (k.default.data.index.isHasVideo && 1 == k.default.data.switchData.show_video_award ? this._handleVideoReward() : 1 == k.default.data.switchData.welfare_for_feed && this._handleWelfareRecomendation()));
            }
            return 0 != e.length || 0 != k.default.data.index.isOpenRedpacket && 0 != k.default.data.switchData.open_packet_papaw || 0 != this._component.data.freeFeedAward && 0 != k.default.data.switchData.show_free_feed || !k.default.data.isAttendanced || (k.default.data.index.isHasVideo && 1 == k.default.data.switchData.show_video_award ? this._handleVideoReward() : 1 == k.default.data.switchData.welfare_for_feed && this._handleWelfareRecomendation()), 
            e;
        }
    }, {
        key: "_hrvestSelfTaskCreate",
        value: function() {
            var e = this._getSelfBrithTaskNoStatLast();
            return e ? (e.aniName = "fadeInBT", e.duration = this._taskAni[Math.floor(5 * Math.random())], 
            e.revenue = r.default.decimalHandler(e.bonus_amount / 1e3), e.event = "自产出", e.count = this._getCountDate(e.task_target), 
            e) : null;
        }
    }, {
        key: "_getCountDate",
        value: function(e) {
            var t = 60 * e, a = wx.getStorageSync("self_brith_date"), n = wx.getStorageSync("last_time_data"), o = 0, d = 0;
            return n = n ? Number(n) : 0, a = a ? Number(a) : 0, o = Date.now() - n, d = 1e3 * a - o, 
            0 == t ? 1 : 0 == n || 0 == a ? t : d < 0 ? 1 : Math.floor(d / 1e3);
        }
    }, {
        key: "_getResConfigByTaskId",
        value: function(e, t) {
            for (var a = null, n = 0, o = t.length; n < o; n++) if (t[n].task_id === e) {
                a = t[n];
                break;
            }
            return a;
        }
    }, {
        key: "_getSelfBrithTaskNoStatLast",
        value: function() {
            for (var e = this._component.data.selfBirthTask, t = null, a = 0, n = e.length; a < n; a++) if (1 === e[a].task_stat) {
                t = e[a];
                break;
            }
            return t;
        }
    }, {
        key: "_getIndexById",
        value: function(e, t) {
            for (var a = -1, n = 0, o = e.length; n < o; n++) if (e[n].id === t) {
                a = n;
                break;
            }
            return a;
        }
    }, {
        key: "_onEggFeedChange",
        value: function(e, t) {
            var a = this, n = r.default.decimalHandler(t[0].egg / 5e5), o = r.default.decimalHandler(t[0].feed / 1e3);
            this._lastFeed = this._component.store.data.index.remainingFeed, this._component.store.data.eggStock = n, 
            this._component.store.data.index.remainingFeed = o, o < 5 ? this.seekFeed() : (!this._harvestIng || this._lastFeed <= 5) && o >= 5 && (this._harvestIng && (c.default.eggLayLogic.lastTime = Date.now()), 
            c.default.eggLayLogic.handleEgglayBefore().then(function(e) {
                a.startTimeCount(e.timeSeconds, e.isSpeeding);
            }).catch(function() {}), this._harvestIng = !1);
        }
    }, {
        key: "judgeNewUserRedPacket",
        value: function() {
            var e = this;
            c.default.packetLogic.getRedPacketList().then(function(t) {
                h.default.i(h.default.TAG_ALL, "首页拉取到的新手红包数据", t);
                for (var a = t.data.redpackets, n = !1, o = 0, d = a.length; o < d; o++) if ("new_user" === a[o].type && !a[o].is_received) {
                    e._newUserRedPacket = a[o], n = !0, k.default.data.index.isHasNewRedpacket = !0;
                    break;
                }
                var i = 1 == e._component.store.data.switchData.new_user_redpacket;
                n && e._newUserRedPacket && i && e._dlgRedbagOpen.show(), e.handleLuckyRedpacket();
            }).catch(function() {
                e.handleLuckyRedpacket();
            });
        }
    }, {
        key: "onOpenRedPacket",
        value: function(e) {
            var t = this;
            console.error("userAuthorizeSuccess"), _.default.openRedPacketAction(this._newUserRedPacket.id).then(function(e) {
                h.default.i(h.default.TAG_ALL, "首页正确打开新手红包", e), t._dlgRedbagOpen.hide(), t._dlgRedbagOpened2.show(Number(t._newUserRedPacket.money / 100)), 
                c.default.notifyCenter.fire(l.NotifyEvent.EGG_CHANGE);
            }).catch(function(e) {
                wx.showToast({
                    title: "打开红包失败,请重试",
                    icon: "none"
                });
            });
        }
    }, {
        key: "inviteFriendForSpeeding",
        value: function() {
            this._dlgFriendAssistance.show();
        }
    }, {
        key: "rewardCanGet",
        value: function(e) {
            console.log("自产出倒计时完成回调:", e), this._lastTaskDetail = e, p.default.complete(e.task_id).then(function(e) {
                console.log("完成任务成功返回", e), wx.setStorageSync("last_time_data", 0), u.default.fetchAllTasks();
            }).catch(function(e) {
                console.log("完成任务失败返回", e), wx.setStorageSync("last_time_data", 0), u.default.fetchAllTasks();
            });
        }
    }, {
        key: "handleLuckyEgg",
        value: function() {
            var e = this;
            k.default.data.index.countDownColsegg > 0 ? this._startCountLuckyEgg(k.default.data.index.countDownColsegg) : k.default.data.index.haveColsegg ? this._startCountLuckyEgg(1) : c.default.extreLogic.colsegg().then(function(t) {
                console.log("是否有彩蛋:", t);
                var a = c.default.switch.get("lucky_egg_count_down", 60, "");
                x.judgeStorageIsToday("luckyEgg") || (a = 1), t && t.ebcnt > 0 && (k.default.data.index.haveColsegg = !0, 
                k.default.data.index.countDownColsegg = a, k.default.data.index.extrewardColsegg = t, 
                e._startCountLuckyEgg(a));
            }).catch(function(e) {
                console.log("是否有彩蛋2:", e);
            });
        }
    }, {
        key: "handleLuckyRedpacket",
        value: function() {
            var e = this;
            if (k.default.data.index.countDownLuckyRedpacket > 0) this._startCountLuckyRedpacket(k.default.data.index.countDownLuckyRedpacket); else if (k.default.data.index.haveLuckyRedpacket) this._startCountLuckyRedpacket(1); else {
                if (0 == k.default.data.switchData.show_lucky_redbag && 1 == k.default.data.switchData.welfare_for_lucky_redbag) return void this._handleWelfareRecomendation();
                c.default.extreLogic.luckyRedpacket().then(function(t) {
                    console.log("是否有幸运红包:", t);
                    var a = c.default.switch.get("lucky_redpacket_count_down", 60, "");
                    x.judgeStorageIsToday("luckyRedpacket") || (a = 1), k.default.data.index.haveLuckyRedpacket = !0, 
                    k.default.data.index.countDownLuckyRedpacket = a, k.default.data.index.extrewardLuckyRedpacket = t, 
                    e._startCountLuckyRedpacket(a), 1 == k.default.data.switchData.welfare_for_lucky_redbag && e._handleFirstEnterForLuckyRedpacket();
                }).catch(function(t) {
                    console.log("是否有幸运红包2:", t), 1 == k.default.data.switchData.welfare_for_lucky_redbag && e._handleWelfareRecomendation();
                });
            }
        }
    }, {
        key: "_startCountLuckyEgg",
        value: function(e) {
            this._component.setData({
                luckyEggCount: e,
                isHasLuckyEgg: !0
            });
        }
    }, {
        key: "_startCountLuckyRedpacket",
        value: function(e) {
            this._component.setData({
                luckyRedbagCount: e,
                isHasLuckyRedpacket: !0
            });
        }
    }, {
        key: "harvestLuckyEggTap",
        value: function() {
            console.log("首页苹果区收割彩蛋！");
            var e = v.default.getAdPercentInType("lucky_percent");
            k.default.data.index.luckyEggAdType = m.default.getType(e.type), console.log("彩蛋广告展示概率情况:", e), 
            this._dlgLuckyReward.show(e);
        }
    }, {
        key: "harvestLuckyRedpacketTap",
        value: function() {
            console.log("首页苹果区收割幸运红包！"), this._dlgLuckyRedPacket.show();
        }
    }, {
        key: "handleFreeFeed",
        value: function(e) {
            var t = this;
            this._freeFeedAdpercent = v.default.getAdPercentInType("free_percent"), k.default.data.index.freeAdType = m.default.getType(this._freeFeedAdpercent.type), 
            console.log("免水滴广告展示概率情况:", this._freeFeedAdpercent), c.default.extreLogic.freefeed(k.default.data.index.freeAdType).then(function(a) {
                console.log("是否有免费水滴:", a), a && a.dayreward && a.extreward && a.extreward.ebcnt > 0 && (k.default.data.index.extrewardFreeBase = a.dayreward, 
                k.default.data.index.extrewardFree = a.extreward, k.default.data.index.haveFreeFeed = !0, 
                t._component.setData({
                    freeFeedAward: a.dayreward / 1e3
                }), e && e());
            }).catch(function() {});
        }
    }, {
        key: "harvestFreeFeedTap",
        value: function() {
            var e = this;
            this.handleFreeFeed(function() {
                console.log("任务奖励区收割免费水滴！"), e._dlgFeedRewardFree.show(e._freeFeedAdpercent);
            });
        }
    }, {
        key: "harvestSignFeedTap",
        value: function() {
            wx.navigateTo({
                url: "/pages/sign/sign"
            });
        }
    }, {
        key: "harvestVideoRewardTap",
        value: function() {
            c.default.videoAd.show(), c.default.videoAd.closeCallBack = function() {
                c.default.extreLogic.verb3(k.default.data.index.extrewardVideo, 3).then(function(e) {
                    e && e.data && e.data.ebcnt > 0 && (wx.showToast({
                        title: "获取 " + e.data.ebcnt / 1e3 + " 克水滴",
                        icon: "none"
                    }), k.default.data.index.isHasVideoReward = !1), c.default.moneyLogic.query().then(function() {}).catch(function() {});
                });
            };
        }
    }, {
        key: "harvestRedpacketTap",
        value: function() {
            console.log("点击开红包水滴泡跳转去我的页面");
            var e = new Date(), t = e.getTime();
            k.default.data.index.isNeedShowManyRedpacketDlg = !0, wx.setStorageSync("openRedpacket", {
                clickNowTime: t,
                diffValue: 60 * (24 - e.getHours()) * 60 * 1e3
            }), this._component.triggerEvent("navigatorSwitch", {
                index: l.TabID.TAB_ID_MINE,
                pageIndex: l.TabID.TAB_ID_MINE,
                pageName: "tab_mine"
            });
        }
    }, {
        key: "_handleNoviceGuidance",
        value: function() {
            var e = this;
            y.default.get([ l.default.NOVICE_GUIDANCE_SWITCH ]).then(function(t) {
                console.log("新手引导状态数据:", t), 0 !== t.code || t.data.value_data[l.default.NOVICE_GUIDANCE_SWITCH] ? e.judgeNewUserRedPacket() : e._component.setData({
                    isShowGuidance: !0
                });
            }).catch(function() {
                e.judgeNewUserRedPacket();
            });
        }
    }, {
        key: "_handleFirstEnterForLuckyRedpacket",
        value: function() {
            x.judgeStorageIsToday("firstLuckyRedpacket") || !k.default.data.index.isHasNewRedpacket && this._component.data.isHasLuckyRedpacket && k.default.data.index.isHasVideo && 0 != k.default.data.switchData.show_lucky_redbag && (this._dlgLuckyRedPacket.show(), 
            x.setStorageInToday("firstLuckyRedpacket"));
        }
    }, {
        key: "_handleWelfareRecomendation",
        value: function() {
            this._dlgFeedRewardFree && this._dlgFeedRewardFree.isShow() || this._dlgFeedRewardTask && this._dlgFeedRewardTask.isShow() || this._dlgLuckyRedPacket && this._dlgLuckyRedPacket.isShow() || this._dlgRedbagOpen && this._dlgRedbagOpen.isShow() || this._dlgRedbagOpened && this._dlgRedbagOpened.isShow() || this._dlgRedbagOpened2 && this._dlgRedbagOpened2.isShow() || this._dlgFriendAssistance && this._dlgFriendAssistance.isShow() || this._component.data.isShowGuidance || this._dlgWelfareRecommendation.show();
        }
    }, {
        key: "_handleVideoReward",
        value: function() {
            var e = this;
            c.default.extreLogic.videoReward(3).then(function(e) {
                console.log("当前视频奖励参数:", e), k.default.data.index.isHasVideoReward = !0, k.default.data.index.extrewardVideo = e;
            }).catch(function(t) {
                k.default.data.index.isHasVideoReward = !1, 1 == k.default.data.switchData.welfare_for_feed && e._handleWelfareRecomendation();
            });
        }
    }, {
        key: "_changeNoviceGuidanceStatus",
        value: function() {
            y.default.set(e({}, l.default.NOVICE_GUIDANCE_SWITCH, "1")).then(function() {}).catch(function() {});
        }
    }, {
        key: "closeNoviceGuidance",
        value: function() {
            this._component.setData({
                isShowGuidance: !1
            }), this._changeNoviceGuidanceStatus(), this.judgeNewUserRedPacket();
        }
    }, {
        key: "startCatchBug",
        value: function() {
            var e = this;
            this._component.data.canCatchBugCount > 0 ? k.default.data.index.remainingFeed < 2 ? wx.showToast({
                icon: "none",
                title: "水滴不足，无法除虫哦"
            }) : R.default.bugFlagClean(1).then(function(t) {
                e._changeBugItem();
            }).catch(function() {}) : wx.showToast({
                icon: "none",
                title: "今日除虫完成，没虫子啦"
            });
        }
    }, {
        key: "_changeBugItem",
        value: function() {
            for (var e = this, t = this._component.data.bugItem, a = 0, n = 0, o = t.length; n < o; n++) if (t[n].isShow && !t[n].isStartCatch) {
                t[n].isStartCatch = !0, a = n;
                break;
            }
            this._component.setData({
                bugItem: t
            }), setTimeout(function() {
                t[a].isShow = !1, e._component.setData({
                    bugItem: t,
                    canCatchBugCount: e._component.data.canCatchBugCount - 1
                }), wx.showToast({
                    icon: "none",
                    title: "完成除虫，保护了苹果树"
                }), c.default.notifyCenter.fire(l.NotifyEvent.EGG_CHANGE), e._bugTipsClose();
            }, 2100);
        }
    }, {
        key: "startCatchFlag",
        value: function() {
            var e = this;
            this._component.data.canCatchFlagCount > 0 ? k.default.data.index.remainingFeed < 2 ? wx.showToast({
                icon: "none",
                title: "水滴不足，无法修剪哦"
            }) : R.default.bugFlagClean(2).then(function(t) {
                e._changeFlagItem();
            }).catch(function() {}) : wx.showToast({
                icon: "none",
                title: "今日修剪完成，没枯叶啦"
            });
        }
    }, {
        key: "_changeFlagItem",
        value: function() {
            for (var e = this, t = this._component.data.flagItem, a = 0, n = 0, o = t.length; n < o; n++) if (t[n].isShow && !t[n].isStartCatch) {
                t[n].isStartCatch = !0, a = n;
                break;
            }
            this._component.setData({
                flagItem: t
            }), setTimeout(function() {
                t[a].isShow = !1, e._component.setData({
                    flagItem: t,
                    canCatchFlagCount: e._component.data.canCatchFlagCount - 1
                }), wx.showToast({
                    icon: "none",
                    title: "完成修剪，保护了苹果树"
                }), c.default.notifyCenter.fire(l.NotifyEvent.EGG_CHANGE), e._flagTipsClose();
            }, 3100);
        }
    }, {
        key: "_handleBugFlag",
        value: function() {
            var e = this;
            R.default.bugFlagCount().then(function(t) {
                if (console.log("当前还有多少虫叶:", t), t && t.data) {
                    var a = t.data, n = a.max_killworm_cnt, o = a.max_trim_cnt, d = a.cur_killworm_cnt, i = a.cur_trim_cnt, s = e._component.data, c = s.bugItem, l = s.flagItem, u = n - d, r = o - i;
                    c = e._bugFlagReset(c, u), l = e._bugFlagReset(l, r), e._component.setData({
                        canCatchBugCount: u,
                        canCatchFlagCount: r,
                        bugItem: c,
                        flagItem: l
                    }), 0 == d && 0 == i && (e._isShowBugTips = !0, e._isShowFlagTips = !0, e.bugFlagTips());
                }
            }).catch(function() {});
        }
    }, {
        key: "_bugFlagReset",
        value: function(e, t) {
            for (var a = e.length - 1, n = 0; n < t; n++) e[a - n].isShow = !0;
            return e;
        }
    }, {
        key: "bugFlagTips",
        value: function() {
            var e = [ {
                bug: 0,
                flag: 1
            }, {
                bug: 1,
                flag: 2
            }, {
                bug: 2,
                flag: 0
            } ][Math.floor(3 * Math.random())], t = this._component.data.bugItem, a = this._component.data.flagItem;
            t[e.bug].isShowTips = !0, a[e.flag].isShowTips = !0, this._component.setData({
                bugItem: t,
                flagItem: a
            });
        }
    }, {
        key: "_flagTipsClose",
        value: function() {
            if (this._isShowBugTips) {
                var e = this._component.data.flagItem;
                e.forEach(function(e) {
                    e.isShowTips = !1;
                }), this._component.setData({
                    flagItem: e
                }), this._isShowBugTips = !1;
            }
        }
    }, {
        key: "_bugTipsClose",
        value: function() {
            if (this._isShowFlagTips) {
                var e = this._component.data.bugItem;
                e.forEach(function(e) {
                    e.isShowTips = !1;
                }), this._component.setData({
                    bugItem: e
                }), this._isShowFlagTips = !1;
            }
        }
    }, {
        key: "_balloonInfoChange",
        value: function() {
            for (var e = arguments.length, t = Array(e), a = 0; a < e; a++) t[a] = arguments[a];
            var n = t[1][0];
            h.default.d(h.default.TAG_ALL, n), this._component.store.data.totalBalloonCount = n.balloon_daily_cnt + n.balloon_firstly_cnt + n.balloon_invite_cnt;
        }
    } ]), s;
}())();

exports.default = b;